Skip to content

add managed auth tools (manage_auth_connections, manage_credentials, manage_credential_providers)#104

Open
masnwilliams wants to merge 6 commits into
mainfrom
hypeship/add-managed-auth-tools
Open

add managed auth tools (manage_auth_connections, manage_credentials, manage_credential_providers)#104
masnwilliams wants to merge 6 commits into
mainfrom
hypeship/add-managed-auth-tools

Conversation

@masnwilliams
Copy link
Copy Markdown
Collaborator

@masnwilliams masnwilliams commented May 24, 2026

Summary

Closes the largest agent-facing capability gap in the MCP server: setting up an authenticated browser session for a third-party site. Agents can now drive Kernel's managed auth flow end-to-end without a human in the loop (beyond the one-time hosted login).

What's added

  • manage_auth_connections (full surface)
    • create — start managing auth for a profile + domain (optionally referencing a pre-stored credential by name, or an external provider like 1Password)
    • list / get / delete
    • login — kicks off a hosted login flow. Returns hosted_url (share with the user to sign in) and live_view_url (agent can watch). Triggers automatic re-auth if credentials are saved.
    • submit — provide field values, an MFA option ID, or an SSO button selector when the flow is awaiting_input. Agent inspects discovered_fields / mfa_options from get to know what's needed.
  • manage_credentials (read-only)
    • list / get (SDK never returns values) / totp_code (current 6-digit code)
    • Intentionally no create/update/delete — credentials are stored by humans via dashboard/CLI so raw secrets never enter the agent's context. The agent references creds by name.
  • manage_credential_providers (read-only)
    • list / get for external providers (e.g. 1Password). Same human-creates / agent-consumes pattern.

Agent flow

  1. Human pre-stores netflix-mason credential in the Kernel dashboard.
  2. Agent: manage_auth_connections create domain=netflix.com profile_name=mason credential_name=netflix-mason
  3. Agent: manage_auth_connections login id=<conn_id> → shares hosted_url with user, or proceeds via re-auth.
  4. Agent polls manage_auth_connections get until flow_status=SUCCESS (or flow_step=AWAITING_INPUT for MFA).
  5. If MFA needed: manage_credentials totp_code <name>manage_auth_connections submit fields={mfa_code: "123456"}.
  6. Any future manage_browsers create profile_name=mason gets a logged-in session.

Test plan

  • Local server starts; tools register without errors
  • manage_auth_connections list returns existing connections for the authed user
  • manage_auth_connections create + login returns a working hosted URL
  • manage_credentials list returns names; totp_code returns a 6-digit code for a TOTP-enabled credential
  • manage_credential_providers list returns configured providers (or empty list)

Tool count

Bumps from 10 → 13.


Note

High Risk
Introduces auth flows, credential CRUD, TOTP retrieval, and provider tokens—security-sensitive surfaces where misuse or SDK behavior could expose secrets or weaken login boundaries.

Overview
Adds managed auth to the MCP server (documented tool count 10 → 13): three new manage_* tools wired to the Kernel SDK in route.ts.

manage_auth_connections drives profile+domain auth: create (with validation for Kernel vs external credential references), list/get/delete, login (hosted + live view URLs), and submit for MFA fields, MFA option IDs, or SSO button selectors, with optional proxy routing.

manage_credentials exposes list/get, totp_code, and create/update/delete for stored credentials (including values, sso_provider, and totp_secret on write paths).

manage_credential_providers covers external providers (e.g. 1Password): full lifecycle plus list_items and test, including service-account tokens on create/update.

The README lists the new capabilities; the rest of the diff is mostly formatting on existing tools (e.g. computer_action).

Reviewed by Cursor Bugbot for commit 0f6eb57. Bugbot is set up for automated code reviews on this repo. Configure here.

…manage_credential_providers)

Closes the largest agent-facing capability gap in the MCP server: setting
up an authenticated browser session for a third-party site. Agents can
now drive Kernel's managed auth flow end-to-end.

- manage_auth_connections: create/list/get/delete connections; start
  login flows (returns hosted_url + live_view_url); submit MFA codes or
  SSO selections when a flow is awaiting input.
- manage_credentials: read-only (list, get, totp_code). Credentials are
  created by humans via dashboard/CLI so the agent never sees raw
  secrets in its context — it references credentials by name.
- manage_credential_providers: read-only (list, get) for external
  providers like 1Password. Same human-creates / agent-consumes pattern.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mcp Ready Ready Preview, Comment May 26, 2026 1:14am

@masnwilliams masnwilliams marked this pull request as ready for review May 24, 2026 20:01
Comment thread src/app/[transport]/route.ts
@firetiger-agent
Copy link
Copy Markdown

Monitoring Plan: Add managed-auth and credentials MCP tools

What this PR does: Registers three new MCP tool handlers — manage_auth_connections (full CRUD + login/submit on managed auth connections), manage_credentials (read-only: list, get, TOTP code fetch), and manage_credential_providers (read-only: list, get) — by adding ~450 lines to the MCP server route handler. The remaining diff is formatting-only changes to existing tools.

Intended effect: After deploy, AI agents using the MCP server can invoke these three tools. Successful calls will appear as spans on the already-active Kernel API backend endpoints (/auth/connections/*, /credentials/*, /org/credential_providers). Pre-deploy baseline on those endpoints: 210–983 calls/hr on auth connections, 144–173 calls/hr on credentials — both with 0 errors in the last 24h. Confirmation: first tool invocations produce new spans on those routes with no error status.

Risks:

  • Tool registration crash — Railway HTTP 5xx rate (all routes); alert if > 15/hr sustained (baseline: 3–8/hr)
  • Auth connection API errors/auth/connections trace spans with status.code = 2; alert if any errors appear post-deploy (baseline: 0/hr)
  • Credentials API errors/credentials + /org/credential_providers trace spans with status.code = 2; alert if any errors appear post-deploy (baseline: 0/hr)
  • SDK method missing at runtimeTypeError: Cannot read properties in Railway HTTP error logs; alert on any such log matching manage_auth_connections, manage_credentials, or manage_credential_providers
  • TOTP misconfiguration/credentials/{id_or_name}/totp-code returning 5xx; alert on any 5xx on this endpoint

Status updates will be posted automatically on this PR as monitoring progresses.

View agent

Cursor Bugbot caught that we were sending invalid credential payloads
when only credential_path or credential_auto was provided without
credential_provider. Add upfront validation so the agent gets a clear
MCP-level error instead of a generic API rejection.
Comment thread src/app/[transport]/route.ts Outdated
Cursor Bugbot follow-up: credential_auto=false was treated as a valid
provider variant, and credential_path + credential_auto: true were
silently allowed together. Only credential_auto: true now counts as a
provider mode, and path/auto are enforced as mutually exclusive.
…providers

also expose list_items and test on credential providers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e945e6e. Configure here.

{
action: z
.enum(["list", "get", "totp_code", "create", "update", "delete"])
.describe("Operation to perform."),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agents can store raw secrets

High Severity

manage_credentials and manage_credential_providers expose create, update, and delete actions that accept passwords, field maps, and provider tokens. The PR states credentials and providers are human-managed only so agents never handle raw secrets; those write paths let an agent persist secrets via MCP.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e945e6e. Configure here.

Comment thread src/app/[transport]/route.ts
Comment thread src/app/[transport]/route.ts
Comment thread src/app/[transport]/route.ts
…t empty credential values

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant